/*****************************************************************************

File:   otkFamilyTableInfoExample.java

Date          Build     Author        Version    Comments
12-Oct-12    P-20-14    dshah         $$1       Created
20-mar-15 P-30-05 gshmelev $$2  called GetCurrentSession


****************************************************************************/

package com.ptc.otkjavaexamples;
 
import com.ptc.cipjava.*;
import com.ptc.pfc.pfcSession.*;
import com.ptc.pfc.pfcCommand.*;
import com.ptc.pfc.pfcGlobal.*;
import com.ptc.pfc.pfcModel.*;
import com.ptc.pfc.pfcModelItem.*;
import com.ptc.pfc.pfcFeature.*;
import com.ptc.pfc.pfcSolid.*;
import javax.swing.JOptionPane;
import java.io.*;

import com.ptc.cipjava.*;
import com.ptc.pfc.pfcFamily.*;
import com.ptc.pfc.pfcServer.*;
import com.ptc.pfc.pfcWindow.*;
import com.ptc.wfc.wfcSolid.*;


 
// Family Table Info
class otkFamilyTableInfoExample extends DefaultUICommandActionListener
{



    public otkFamilyTableInfoExample()
	{
	}
	
	
	
	
	public void OnCommand()
	{
		addFamilyTableInfoExample();
	}
	
	public int addFamilyTableInfoExample()
	{

		try
		{
			String line;
			String InfoFile_name;

			Session session = pfcSession.GetCurrentSession ();
			WSolid wSolid = (WSolid)(session.GetCurrentModel());

			if(wSolid != null)
			{
				InfoFile_name = "FamilyTable_info.txt";
				
				FileWriter file = new FileWriter(InfoFile_name);
				BufferedWriter fp_InfoFile = new BufferedWriter(file);

				otkFamilyTableUtils.OtkUtilFamilyTableInfo(wSolid, fp_InfoFile);
				fp_InfoFile.close();

				// Code to display info file into Pro/E browser window
				Window current_win = session.GetCurrentWindow ();
				line = "file://";
				line += session.GetCurrentDirectory();
				line += InfoFile_name;
				current_win.SetURL(line);
			} // try
			return (0);
		}
		catch (Exception e)
		{
			System.out.println("1: " + e);
		}	
		return 0;
	}
	

};






